/*
 * @Author: your name
 * @Date: 2021-07-08 15:11:00
 * @LastEditTime: 2021-09-24 11:54:01
 * @LastEditors: wei_jt@ecidi.com
 * @Description: In User Settings Edit
 * @FilePath: \central-system\src\modules\System\UserManagement\api.js
 */
import request from '@/utils/request'

//获得所有用户分页
export function getUsers (params) {
  return request({
    url: '/sys-user/users/page',
    method: 'get',
    params: params
  })
}
//新增用户
export function saveUsers (data) {
  return request({
    url: '/sys-user/user',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
//更新用户
export function editUsers (data) {
  return request({
    url: '/sys-user/user',
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
//根据搜索条件查询用户userName,orgId
export function searchUsers (orgNo, page, searchValue, size) {
  return request({
    url: '/sys-user/users/search',
    method: 'get',
    params: {
      orgNo,
      page,
      searchValue,
      size
    }
  })
}
//查询用户角色 (参数为用户id)
export function getRoles (data) {
  return request({
    url: '/sys-user/user/roles/page',
    method: 'get',
    params: data
  })
}
//导入人员模板
export function downloadPeopleTemplates () {
  return request({
    url: '/sys-user/user/template',
    method: 'get',
    responseType: 'blob'
  })
}
//导入人员
export function importPeople (data) {
  return request({
    url: '/sys-user/users/import',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
//导出用户模板
export function downloadUserTemplates () {
  return request({
    url: '/sys-user/account/template',
    method: 'get',
    responseType: 'blob'
  })
}
//导入用户
export function importUser (data) {
  return request({
    url: '/sys-user/accounts/import',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
//导出用户
export function exportUser (data) {
  return request({
    url: '/sys-user/accounts/export',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
//下载部门导入模板
export function downloadOrgTemplates () {
  return request({
    url: '/sys-user/org/template',
    method: 'get',
    responseType: 'blob'
  })
}
//下载岗位导入模板
export function downloadPostTemplates () {
  return request({
    url: '/sys-user/post/template',
    method: 'get',
    responseType: 'blob'
  })
}
//导入部门
export function importOrg (data) {
  return request({
    url: '/sys-user/orgs/import',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
//导入岗位
export function importPost (data) {
  return request({
    url: '/sys-user/posts/import',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}